#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <set>
using namespace std;
typedef pair<int, int> PII;
set<int> ans;
unordered_map<int, int> hsh;
const int N = 100010;
PII arr[N];
int n, d, k;

int main()
{
    cin >> n >> d >> k;
    for (int i = 1; i <= n; ++i)
    {
        int a, b;
        cin >> a >> b;
        arr[i] = {a, b};
    }
    sort(arr + 1, arr + 1 + n);
    for (int i = 1, j = 1; j <= n;)
    {
        int st = arr[i].first;
        while (j <= n && arr[j].first < arr[i].first + d)
        {
            hsh[arr[j].second]++;
            if (hsh[arr[j].second] >= k)
                ans.insert(arr[j].second);
            j++;
        }
        hsh[arr[i].second]--;
        ++i;
    }
    for (auto e : ans)
        cout << e << endl;
    // cout << endl;
    return 0;
}